package com.atwork.controller;

import com.atwork.service.SysDeptService;
import com.atwork.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @CreateBy: zhaojun
 * @CreateTime: 2018-08-04
 * @Desc: 部门管理Controller
 */
@Controller
@RequestMapping(value = "/dept")
public class SysDeptController {
    @Autowired
    private SysDeptService sysDeptService;
    /**
     * 分页获取全部系统部门
     * @param pageNum
     * @param pageSize
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getAllDept/{pageNum}/{pageSize}")
    public Object getAllRole(@PathVariable("pageNum") int pageNum,
                             @PathVariable("pageSize")int pageSize){
        return sysDeptService.getAllDept(pageNum,pageSize);
    }

    /**
     * 通过id获取部门
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getDeptById/{id}")
    public Object getRoleById(@PathVariable("id") int id){
        return sysDeptService.getDeptById(id);
    }
}
